package includes;

import java.security.MessageDigest;

public class MD5 {
	String message;
    public MD5()
    {
    }
    public String md5(String message) {
    	this.message=message;
    	try
        {
	        MessageDigest md = MessageDigest.getInstance("MD5");
	        String md5string="";
	        StringBuffer sb = new StringBuffer();
	        byte buf[] = message.getBytes();
	        byte[] md5 = md.digest(buf);
	        for( int i = 0 ; i < md5.length ; i++ ) {
		        String tmpStr = "0"+Integer.toHexString( (0xff & md5[i]));
		        sb.append(tmpStr.substring(tmpStr.length()-2));
	        }       
	        md5string = sb.toString();
	    	return (md5string);
        }
		catch (Exception e)
		{
			System.out.println(e);
		}
		return message;
    }
}
